#ifndef __EXLOBBY_AVATAR_NODE__
#define __EXLOBBY_AVATAR_NODE__

#include "ExLobbyDDL.h"

namespace Atlas
{

	class CExLobbyRoomComponent;
	class CExLobbyRoomNodeServer;
	class CExLobbyRoomNodeClient;

	typedef DDL::TMemoryWriter<1*1024> ExLobbyMemoryWriter;

	class CExLobbyRoomComponent : public CServerComponent
	{
	public:
		typedef DDLStub::ROOM_C2S<CExLobbyRoomNodeClient, CExLobbyRoomComponent>		ROOM_C2S_STUB;
		typedef CNodeStub<ROOM_C2S_STUB, CExLobbyRoomNodeClient, CExLobbyRoomComponent>	ROOM_STUB;

		CExLobbyRoomComponent(CExLobbyRoomNodeServer* pServer);
		virtual ~CExLobbyRoomComponent();

		void LoginDone(CExLobbyRoomNodeClient* pClient);

	private:
		ROOM_STUB m_RoomStub;
	};

	class CExLobbyRoomNodeServer : public CNodeServer
	{
	public:
		CExLobbyRoomNodeServer(CServerApp* pServerApp);
		virtual ~CExLobbyRoomNodeServer();

		virtual CNodeClient* NewNodeClient(_U64 nndx, _U64 cndx, HSERVER hCluster);
	};

	class CExLobbyRoomNodeClient : public CNodeClient
	{
	public:
		CExLobbyRoomNodeClient(CExLobbyRoomNodeServer* pServer, _U64 nndx, _U64 cndx, HSERVER hCluster);
		virtual ~CExLobbyRoomNodeClient();

		virtual void OnConnect(_U32 len, const _U8* data);
		virtual void OnDisconnect();
		virtual void OnData(_U16 code, _U32 len, const _U8* data);
		virtual void OnEvent(_U16 code, _U32 len, const _U8* data);

		DDLProxy::ROOM_S2C<CExLobbyRoomNodeClient, ExLobbyMemoryWriter> Room;
	};

}

#endif
